package esa.isoc.statistics;

import java.util.StringTokenizer;


public class NewEntry implements Entry{
	public double hours;
	public long time;	
	public double fraction;
	public String comment;
	
	public NewEntry(StringTokenizer st) {
		
		String hoursSt = st.nextToken().trim();
		
		if (hoursSt.length()>0){
			hours = Double.parseDouble(hoursSt);
		}
		
		String timeSt = st.nextToken().trim();
		
		if (timeSt.length()>0){
			time =  Long.parseLong(timeSt);
		}
		
		String fractionSt = st.nextToken().trim();
		if (timeSt.length()>0){
			fraction = Double.parseDouble(fractionSt);
		}
		
		if (st.hasMoreElements()) {
			this.comment = hoursSt;
		} else {
			this.comment = null;
		}
	}
	public NewEntry(double hours, long time, double fraction, StringTokenizer st) {
		this.hours = hours;
		this.time = time;
		this.fraction = fraction;
		if (st.hasMoreElements()) {
			this.comment = st.nextToken();
		} else {
			this.comment = null;
		}
		
	}
	@Override
	public String toString() {
		return "Entry [hours=" + hours + ", time=" + time + ", fraction="
				+ fraction + ", comment=" + comment + "]";
	}
	@Override
	public double getHours() {
		return hours;
	}
	@Override
	public long getTime() {
		return time;
	}
	@Override
	public double getFraction() {
		return fraction;
	}
	@Override
	public String getComment() {
		return comment;
	}
	
	
	
		
}
